package com.lirh.mysql.controller;

import com.lirh.mysql.dao.CommentDao;
import com.lirh.mysql.entity.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/comment")
public class CommentController {
    @Autowired
    CommentDao commentDao;
    @PostMapping("/insert")
    public String insert(@RequestBody Comment comment){
        commentDao.insert(comment);
        return "ok";
    }
    @GetMapping("/get/{id}")
    public Comment get(@PathVariable("id") int id){
        return commentDao.selectById(id);
    }
}
